package bitset;

import java.util.BitSet;

public class Test {
    public static void main(String[] args) {

        MyBitSet myBitSet = new MyBitSet(18);
        myBitSet.set(13);
        myBitSet.set(1);
        myBitSet.set(24);
        myBitSet.set(31);
        myBitSet.set(7);
        System.out.println(myBitSet.get(32));
    }

    public int findIndex(int[] nums, int target){
        int left = 0;
        int right = nums.length-1;

        while (left <= right){
            int middle = left + ((right - left) >> 1);
            if(nums[middle] > target){
                right = middle - 1;
            }else if (nums[middle] < target){
                left = middle + 1;
            }else{
                return middle;
            }
        }
        return -1;
    }


    public static void main1(String[] args) {

        int[] arr = {1,2,3,15,13,4,34};

        BitSet set = new BitSet();
        for (int  num : arr) {
            set.set(num);
        }
        System.out.println(set.get(34));
    }
}
